import java.io.*;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-10-17
 * Time: 20:57
 */
public class test_1 {
    //PrintWriter里面的方法和System.out的使用方法一样
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();

    public static void main(String[] args) throws IOException {
        long apple = in.nextInt();
        long peach = in.nextInt();

        long a = in.nextInt();
        long b = in.nextInt();

        long sum = 0;
        //礼包1的个数
        for (int i = 0; i <= Math.min(apple / 2, peach); i++) {
            //剩余桃数
            long haveTao = peach - i;
            //剩余苹果数
            long haveApple = apple - 2L * i;
            //礼包2的个数
            long j = Math.min(haveApple, haveTao / 2);
            sum = Math.max(sum, i * a + b * j);

        }
        System.out.println(sum);
    }
}


//快读模板
class Read {//自定义快读读入
    //字符串裁剪
    StringTokenizer st = new StringTokenizer("");

    //1.字节流System.in->字符流InputStreamReader
    //2.带内存缓冲区的字符流BufferedReader
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));


    String next() throws IOException {
        //为什么要while循环，因为可能读取的数据不止一行，有多行就需要多次取
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());//先拿一行的数据
        }
        return st.nextToken();//对这一行的数据进行裁剪，拿到第一个数据
    }

    String nextLine() throws IOException {
        return bf.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

}
